/*!
\file glview.cpp Program's main file
*/

#include "stdafx.h"

#include <cstdlib>

#include "App.h"
#include "Log.h"

/*!
    Main function that creates App object, initializes and run.
    \attention Top-most exception handling goes here.
*/
int _tmain(int argc, _TCHAR* argv[])
{
    try {
        App theApp;

        LOG_INFO("Initializing application...");
        if(!theApp.init())
        {
            LOG_ERROR("Application failed to initialize");
            std::exit(EXIT_FAILURE);
        }

    LOG_INFO("Running application...");
    theApp.run();
    LOG_INFO("Application ended. Exiting...");
    }
    catch(std::exception & e)
    {
        LOG_ERROR("std::exception catched: " << e.what());
        std::exit(EXIT_FAILURE);
    }
    catch(...)
    {
        LOG_ERROR("Unknown exception catched: ");
        std::exit(EXIT_FAILURE);
    }

    std::exit(EXIT_SUCCESS);
}
